home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / ncurses-5.3.lha / ncurses-5.3 / test / configure.in < prev    next >
Text File  |  2002-10-24  |  10KB  |  328 lines

  1. dnl***************************************************************************
  2. dnl Copyright (c) 1998-2000,2002 Free Software Foundation, Inc.              *
  3. dnl                                                                          *
  4. dnl Permission is hereby granted, free of charge, to any person obtaining a  *
  5. dnl copy of this software and associated documentation files (the            *
  6. dnl "Software"), to deal in the Software without restriction, including      *
  7. dnl without limitation the rights to use, copy, modify, merge, publish,      *
  8. dnl distribute, distribute with modifications, sublicense, and/or sell       *
  9. dnl copies of the Software, and to permit persons to whom the Software is    *
  10. dnl furnished to do so, subject to the following conditions:                 *
  11. dnl                                                                          *
  12. dnl The above copyright notice and this permission notice shall be included  *
  13. dnl in all copies or substantial portions of the Software.                   *
  14. dnl                                                                          *
  15. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
  16. dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
  17. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
  18. dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
  19. dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
  20. dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
  21. dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
  22. dnl                                                                          *
  23. dnl Except as contained in this notice, the name(s) of the above copyright   *
  24. dnl holders shall not be used in advertising or otherwise to promote the     *
  25. dnl sale, use or other dealings in this Software without prior written       *
  26. dnl authorization.                                                           *
  27. dnl***************************************************************************
  28. dnl
  29. dnl Author: Thomas E. Dickey 1996, etc.
  30. dnl
  31. dnl $Id: configure.in,v 1.36 2002/09/07 16:55:23 tom Exp $
  32. dnl This is a simple configuration-script for the ncurses test programs that
  33. dnl allows the test-directory to be separately configured against a reference
  34. dnl system (i.e., sysvr4 curses)
  35. dnl
  36. dnl If you're configuring ncurses, you shouldn't need to use this script.
  37. dnl It's only for testing purposes.
  38. dnl
  39. dnl See http://invisible-island.net/autoconf/ for additional information.
  40. dnl ---------------------------------------------------------------------------
  41. AC_PREREQ(2.13.20000819)
  42. AC_INIT(ncurses.c)
  43. AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
  44.  
  45. AC_PROG_CC
  46.  
  47. dnl Things that we don't need (or must override) if we're not building ncurses
  48. CC_G_OPT="-g"                AC_SUBST(CC_G_OPT)
  49. CC_SHARED_OPTS=unknown            AC_SUBST(CC_SHARED_OPTS)
  50. CPPFLAGS="$CPPFLAGS"            AC_SUBST(CPPFLAGS)
  51. DFT_DEP_SUFFIX=""            AC_SUBST(DFT_DEP_SUFFIX)
  52. DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'`    AC_SUBST(DFT_OBJ_SUBDIR)
  53. DFT_UPR_MODEL="NORMAL"            AC_SUBST(DFT_UPR_MODEL)
  54. ECHO_LINK='@ echo linking $@ ... ;'    AC_SUBST(ECHO_LINK)
  55. EXTRA_LIBS=""                AC_SUBST(EXTRA_LIBS)
  56. LD="ld"                    AC_SUBST(LD)
  57. LDFLAGS_SHARED=""            AC_SUBST(LDFLAGS_SHARED)
  58. LD_MODEL=""                AC_SUBST(LD_MODEL)
  59. LD_SHARED_OPTS=""            AC_SUBST(LD_SHARED_OPTS)
  60. LIBTOOL=""                AC_SUBST(LIBTOOL)
  61. LIB_NAME=curses                AC_SUBST(LIB_NAME)
  62. LIB_PREFIX="-l"                AC_SUBST(LIB_PREFIX)
  63. LINK_TESTS=""                AC_SUBST(LINK_TESTS)
  64. LINT=lint                AC_SUBST(LINT)
  65. LINT_OPTS=""                AC_SUBST(LINT_OPTS)
  66. LOCAL_LDFLAGS=""            AC_SUBST(LOCAL_LDFLAGS)
  67. MATH_LIB="-lm"                AC_SUBST(MATH_LIB)
  68. PROG_EXT=""                AC_SUBST(PROG_EXT)
  69. TEST_ARGS=""                AC_SUBST(TEST_ARGS)
  70. TEST_DEPS=""                AC_SUBST(TEST_DEPS)
  71. cf_cv_abi_version=""            AC_SUBST(cf_cv_abi_version)
  72. cf_cv_rel_version=""            AC_SUBST(cf_cv_rel_version)
  73.  
  74. dnl SunOS 4.x
  75. AC_ARG_WITH(5lib,
  76.     [  --with-5lib             use SunOS sysv-libraries],
  77.     [LIBS="-L/usr/5lib $LIBS"
  78.      CPPFLAGS="$CPPFLAGS -I/usr/5include"])
  79.  
  80. dnl ---------------------------------------------------------------------------
  81. dnl Check for libutf8
  82. AC_DEFUN([CF_LIBUTF8],
  83. [
  84. AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
  85.     cf_save_LIBS="$LIBS"
  86.     LIBS="-lutf8 $LIBS"
  87. AC_TRY_LINK([
  88. #include <libutf8.h>],[putwc(0,0);],
  89.     [cf_cv_libutf8=yes],
  90.     [cf_cv_libutf8=no])
  91.     LIBS="$cf_save_LIBS"
  92. ])
  93.  
  94. if test "$cf_cv_libutf8" = yes ; then
  95.     AC_DEFINE(HAVE_LIBUTF8_H)
  96.     LIBS="-lutf8 $LIBS"
  97. fi
  98. ])dnl
  99.  
  100. dnl ---------------------------------------------------------------------------
  101. dnl NcursesW, installed in conventional location
  102. AC_ARG_WITH(ncursesw,
  103.     [  --with-ncursesw         use wide ncurses-libraries (installed)],
  104.     [
  105.      AC_DEFINE(_GNU_SOURCE)
  106.      AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
  107.      AC_CHECK_FUNC(initscr,,[
  108.      AC_CHECK_LIB(gpm,Gpm_Open)
  109.      LIB_NAME=ncursesw
  110.      AC_CHECK_FUNC(putwc,,[CF_LIBUTF8])
  111.      for p in $HOME /usr/local /usr
  112.      do
  113.          if test -f $p/include/ncursesw/curses.h
  114.         then
  115.             CPPFLAGS="$CPPFLAGS -I$p/include/ncursesw"
  116.             test $p != /usr && CPPFLAGS="$CPPFLAGS -I$p/include"
  117.             test $p != /usr && LIBS="-L$p/lib $LIBS"
  118.             break
  119.         elif test $p != /usr
  120.         then
  121.             if test -f $p/include/curses.h
  122.             then
  123.                 CPPFLAGS="$CPPFLAGS -I$p/include"
  124.                 LIBS="-L$p/lib $LIBS"
  125.                 break
  126.             fi
  127.         fi
  128.      done
  129.     ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])])
  130.  
  131. dnl Ncurses, installed in conventional location
  132. AC_ARG_WITH(ncurses,
  133.     [  --with-ncurses          use ncurses-libraries (installed)],
  134.     [AC_CHECK_FUNC(initscr,,[
  135.      AC_CHECK_LIB(gpm,Gpm_Open)
  136.      LIB_NAME=ncurses
  137.      for p in $HOME /usr/local /usr
  138.      do
  139.          if test -f $p/include/ncurses/curses.h
  140.         then
  141.             CPPFLAGS="$CPPFLAGS -I$p/include/ncurses"
  142.             test $p != /usr && CPPFLAGS="$CPPFLAGS -I$p/include"
  143.             test $p != /usr && LIBS="-L$p/lib $LIBS"
  144.             break
  145.         elif test $p != /usr
  146.         then
  147.             if test -f $p/include/curses.h
  148.             then
  149.                 CPPFLAGS="$CPPFLAGS -I$p/include"
  150.                 LIBS="-L$p/lib $LIBS"
  151.                 break
  152.             fi
  153.         fi
  154.      done
  155.     ],[test -d /usr/ccs/lib && LIBS="-L/usr/ccs/lib $LIBS"])])
  156.  
  157. dnl If we've not specified a library, assume we're using sysvr4 libraries
  158. dnl installed conventionally (e.g., SunOS 5.x - solaris).
  159.  
  160. dnl Autoconf builds up the $LIBS in reverse order
  161.  
  162. AC_CHECK_FUNC(initscr,,[
  163. AC_CHECK_LIB($LIB_NAME,initscr)])
  164. AC_CHECK_LIB(form,form_driver)
  165. AC_CHECK_LIB(menu,menu_driver)
  166. AC_CHECK_LIB(panel,new_panel)
  167.  
  168. AC_TYPE_SIGNAL
  169.  
  170. AC_STDC_HEADERS
  171. AC_HEADER_TIME
  172. AC_CHECK_HEADERS( \
  173. form.h \
  174. getopt.h \
  175. locale.h \
  176. menu.h \
  177. nc_alloc.h \
  178. nomacros.h \
  179. panel.h \
  180. sys/ioctl.h \
  181. sys/select.h \
  182. sys/time.h \
  183. termios.h \
  184. unistd.h \
  185. )
  186.  
  187. AC_CHECK_FUNCS( \
  188. getnstr \
  189. gettimeofday \
  190. napms \
  191. resize_term \
  192. resizeterm \
  193. strdup \
  194. use_default_colors \
  195. vsscanf \
  196. wresize \
  197. )
  198.  
  199. dnl ---------------------------------------------------------------------------
  200. dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
  201. dnl It's a character string "SVR4", not documented.
  202. AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
  203. AC_TRY_RUN([
  204. #include <curses.h>
  205. int main()
  206. {
  207.     char temp[1024];
  208.     sprintf(temp, "%s\n", curses_version());
  209.     exit(0);
  210. }]
  211. ,[cf_cv_func_curses_version=yes]
  212. ,[cf_cv_func_curses_version=no]
  213. ,[cf_cv_func_curses_version=unknown])
  214. rm -f core])
  215. test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
  216.  
  217. dnl ---------------------------------------------------------------------------
  218. dnl Check for likely values of acs_map[]:
  219. AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
  220. cf_cv_curses_acs_map=unknown
  221. for name in acs_map _acs_map __acs_map _nc_acs_map
  222. do
  223. AC_TRY_LINK([
  224. #include <curses.h>
  225. ],[
  226. $name['k'] = ACS_PLUS
  227. ],[cf_cv_curses_acs_map=$name; break])
  228. done
  229. ])
  230.  
  231. test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
  232.  
  233. dnl ---------------------------------------------------------------------------
  234. dnl Check for likely values of wacs_map[]:
  235. AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
  236. cf_cv_curses_wacs_map=unknown
  237. for name in wacs_map _wacs_map __wacs_map _nc_wacs
  238. do
  239. AC_TRY_LINK([
  240. #ifndef _XOPEN_SOURCE_EXTENDED
  241. #define _XOPEN_SOURCE_EXTENDED
  242. #endif
  243. #include <curses.h>
  244. ],[
  245. $name['k'] = *WACS_PLUS    
  246. ],[cf_cv_curses_wacs_map=$name; break])
  247. done
  248. ])
  249.  
  250. test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map)
  251.  
  252. dnl --------------------------------------------------------------------------- 
  253. dnl Make an uppercase version of a variable 
  254. dnl $1=uppercase($2) 
  255. AC_DEFUN([CF_UPPER], 
  256. $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
  257. ])dnl 
  258.  
  259. dnl ---------------------------------------------------------------------------
  260. dnl Check if curses.h defines the given type
  261. AC_DEFUN([CF_CURSES_TYPE],
  262. [
  263. AC_MSG_CHECKING(for type $1 in curses.h)
  264. AC_TRY_COMPILE([
  265. #ifndef _XOPEN_SOURCE_EXTENDED
  266. #define _XOPEN_SOURCE_EXTENDED
  267. #endif
  268. #include <curses.h>],[
  269. $1 foo
  270. ],cf_result=yes,cf_result=no)
  271. AC_MSG_RESULT($cf_result)
  272. if test $cf_result = yes ; then
  273.     CF_UPPER(cf_result,have_type_$1)
  274.     AC_DEFINE_UNQUOTED($cf_result)
  275. else
  276.     AC_DEFINE_UNQUOTED($1,$2)
  277. fi
  278. ])dnl
  279.  
  280. CF_CURSES_TYPE(attr_t,long)
  281. CF_CURSES_TYPE(mbstate_t,long)
  282.  
  283. dnl ---------------------------------------------------------------------------
  284. dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
  285. dnl older SCO configurations.
  286. dnl [CF_SYS_TIME_SELECT]
  287.  
  288. AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
  289. AC_CACHE_VAL(cf_cv_sys_time_select,[
  290. AC_TRY_COMPILE([
  291. #include <sys/types.h>
  292. #ifdef HAVE_SYS_TIME_H
  293. #include <sys/time.h>
  294. #endif
  295. #ifdef HAVE_SYS_SELECT_H
  296. #include <sys/select.h>
  297. #endif
  298. ],[],[cf_cv_sys_time_select=yes],
  299.      [cf_cv_sys_time_select=no])
  300.      ])
  301. AC_MSG_RESULT($cf_cv_sys_time_select)
  302. test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
  303.  
  304. dnl ---------------------------------------------------------------------------
  305.  
  306. AC_OUTPUT(Makefile,[
  307.     cat >>Makefile <<TEST_EOF
  308.  
  309. # These rules are generated so we do not rely on suffix rules, which do not
  310. # work consistently for different make-programs (the '\$(MODEL)/' confuses
  311. # some, and the '\$x' confuses others).
  312. TEST_EOF
  313. LIST=`make echo_tests`
  314. LAST=`make echo_suffix`
  315. for n in $LIST
  316. do
  317.     N=`echo $n | sed -e s/${LAST}\$//`
  318.     cat >>Makefile <<TEST_EOF
  319.  
  320. \$(MODEL)/$N.o : $N.c \\
  321.     test.priv.h \\
  322.     ncurses_cfg.h
  323.     @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
  324. TEST_EOF
  325. done
  326. ],[],sort)
  327.